package com.lepton.wifidog;

import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/ping/")
public class pingHandle extends HttpServlet {
	private static final long serialVersionUID = 2L;
	
	public pingHandle(){
		
	}
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response){
		Date d = new Date();
		String s = null;
		DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		s = sdf.format(d);
		System.out.println(s + " : get method ping");
		try {
			response.getWriter().write("Pong");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response){
		System.out.println("post method ping");
	}
}
